package com.nf.action;

import com.nf.entity.Article;
import com.nf.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ArticleAction {

    @Autowired
    private ArticleService articleService;

    @ResponseBody
    @RequestMapping("/getArticleById")
    public Article getArticleById(Integer id){
        return articleService.getArticleById(id);
    }

    @ResponseBody
    @RequestMapping("/getArticleListByCategoryId")
    public List<Article> getArticleListByCategoryId(Integer categoryId){
        System.out.println("有人访问getArticleListByCategoryId");
        return articleService.getArticleListByCategoryId(categoryId);
    }
}
